package us.gaaoc.framework.dao;
/*
 * @author Frank
 */
import org.hibernate.Query;

import us.gaaoc.framework.model.LdapDirectoryPerson;
import us.gaaoc.framework.model.Person;

public class LdapDirectoryPersonDAOHibernate extends
GenericHibernateDAO<LdapDirectoryPerson, String, LdapDirectoryPersonDAO> implements
LdapDirectoryPersonDAO {
	
	public LdapDirectoryPerson findLdapDirectoryByPerson(Person person) {
		String uuid = person.getUuid();
		Query q = getSession().createQuery("from LdapDirectoryPerson d where d.person.userId = ?" );
		q.setString(0, person.getUserId());
		
		/*
		java.util.List l = q.list();
		for(Object o : l)
		{
			LOG.debug(((LdapDirectoryPerson)o).getUuid());
		}
		*/
		
		return  (LdapDirectoryPerson)q.uniqueResult();
	}
}